<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>企业信息</title>
	<meta name="decorator" content="default"/>
	<style type="text/css">
	.showImgDiv{
		float:left;
		width:100px;
		height:100px;
	    margin-left: 10px;
		border: 2px solid rgba(0, 0, 0, 0.3);
	}
	.showImgDiv img{
		width: 100%;
		height:100%;
	}
	</style>
	<script type="text/javascript">
		$(document).ready(function() {
			//$("#name").focus();
			var curLength=$("#remarkArea").val().length;
			if(curLength>100){
				$("#textLength").css("color","red");
				$("#textLength").text(curLength+"/100");
			}else{
				$("#textLength").text(curLength+"/100");
			}
			$("#inputForm").validate({
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				rules:{          
					remark:{remarkCheck:true,remarkCheckNull:true} 
	            },
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
			jQuery.validator.addMethod("remarkCheck", function(value,  
	                element, param) { 
				if(value.length>100){
					return false;
				} else{
					return true;
	            }
	        }, $.validator.format("字数超限"));  
			jQuery.validator.addMethod("remarkCheckNull", function(value,  
	                element, param) { 
				if(value==null){
					return false;
				} else{
					if(value==""){
						return false;
					}else{
						return true;
					}
	            }
	        }, $.validator.format("请输入审核不通过原因"));  
			$("input[name='examineState']").change(function(){
				var $selectedvalue = $("input[name='examineState']:checked").val();
				if($selectedvalue ==3){
					$("#refuseReson").css("display","");
				}else{
					$("#refuseReson").css("display","none");
				}
			});
			$("#remarkArea").keyup(function(){
				var curLength=$("#remarkArea").val().length;
				if(curLength>100){
					$("#textLength").css("color","red");
					$("#textLength").text(curLength+"/100");
				}else{
					$("#textLength").css("color","");
					$("#textLength").text(curLength+"/100");
				}
			})
			/* $('.showImgDiv img').click(function(){
				var src = $(this).attr('src');
				window.open(src);  
			}) */
		});
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li><a href="${ctx}/sys/commonUser/vipUserList">会员用户审核列表</a></li>
		<li class="active"><a href="${ctx}/sys/commonUser/companyAuditing?id=${user.id}">企业审核<shiro:hasPermission name="sys:yonguser:user:edit">${not empty user.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="sys:yonguser:user:edit">查看</shiro:lacksPermission></a></li>
	</ul><br/>
	<form:form id="inputForm" modelAttribute="user" action="${ctx}/sys/commonUser/companyAuditingPass" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<div style="display:none;">
			<sys:message content="${message}"/>
		</div>	
		<div class="control-group">
			<label class="control-label">用户名:</label>
			<div class="controls">
				<label class="lbl">${user.loginName}</label>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">手机号:</label>
			<div class="controls">
				<label class="lbl">${user.mobile}</label>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">公司名称：</label>
			<div class="controls">
				<label class="lbl">${user.company}</label>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">企业类型：</label>
			<div class="controls">
				<label class="lbl">${fns:getDictLabel(user.companyType, 'company_type', '')}</label>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">企业规模：</label>
			<div class="controls">
				<label class="lbl">${fns:getDictLabel(user.companySize, 'company_size', '')}</label>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">电子邮箱：</label>
			<div class="controls">
				<label class="lbl">${user.email}</label>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">联系人：</label>
			<div class="controls">
			<label class="lbl">${user.linkman}</label>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">联系人电话：</label>
			<div class="controls">
				<label class="lbl">${user.linkmanPhone}</label>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">所在地区：</label>
			<div class="controls">
				<label class="lbl">${user.provinceName}${user.cityName}</label>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">详细地址：</label>
			<div class="controls">
				<label class="lbl">${user.provinceName}${user.cityName}${user.areaName}${user.address}</label>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">企业信息：</label>
			<c:if test="${not empty user.taxRegistrationCertificate}">
				<div class="showImgDiv">
   					<img src="${user.taxRegistrationCertificate}" data-action="zoom" >
				</div>
			</c:if>
			<c:if test="${not empty user.organizationCodeCertificate}">
				<div class="showImgDiv">
	   				<img src="${user.organizationCodeCertificate}" data-action="zoom" >
				</div>
			</c:if>
			<c:if test="${not empty user.openBankAccountPermitCertificate}">
			<div class="showImgDiv">
   				<img src="${user.openBankAccountPermitCertificate}" data-action="zoom" >
			</div>
			</c:if>
			<c:if test="${not empty user.businessLicence}">
				<div class="showImgDiv">
	   				<img src="${user.businessLicence}" data-action="zoom" >
				</div>
			</c:if>
			<c:if test="${not empty user.titleImage}">
				<div class="showImgDiv">
					<img src="${user.titleImage}" data-action="zoom"/>
				</div>
			</c:if>
		</div>
		<div class="control-group">
			<div class="controls" style="margin-left:70px">
				<form:radiobutton path="examineState" value="2"/>审核通过&emsp;
				<form:radiobutton path="examineState" value="3" checked="true"/>审核不通过
			</div>
		</div>
		<div class="control-group" id="refuseReson">
			<div class="controls" style="position: relative;margin-left:70px">
				<textarea rows="2" cols="2" id="remarkArea" name="remark" placeholder="请输入审核不通过的原因"></textarea>
				<span id="textLength" style="bottom:1px;position:absolute;line-height:1;">0/100</span>
			</div>
		</div>
		<div class="form-actions">
			<shiro:hasPermission name="sys:commonUser:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="确定"/>&nbsp;</shiro:hasPermission>
			<input id="btnCancel" class="btn" type="button" value="取消" onclick="history.go(-1)"/>
		</div>
	</form:form>
</body>
</html>